<table class="table table-bordered table-hover table-striped">
	<tbody>
		<tr align="center">
			<td><strong>编号</strong></td>
			<td><strong>房间号</strong></td>
			<td><strong>合同编号</strong></td>
			<td><strong>客人姓名</strong></td>
			<td><strong>押金</strong></td>
			<td><strong>联系方式</strong></td>
			<td><strong>缴费时间</strong></td>
			<td><strong>费用截止时间</strong></td>
			<td><strong>水表起数</strong></td>
			<td><strong>电表起数</strong></td>
			<td><strong>气表起数</strong></td>
			<td><strong>操作员</strong></td>
			<td><strong>添加时间</strong></td>
			<td><strong>状态</strong></td>
			<td><strong>验证码</strong></td>
			<td><strong>操作</strong></td>
		</tr>
		<?php if($userlist){ foreach($userlist as $k=>$user){ ?>
		<tr align="center">
			<td><?php echo ($page-1)*C('PAGE_SIZE')+($k+1); ?></td>
			<td>{$user['room_number']}</td>
			<td>{$user['contract']}</td>
			<td>{$user['member_nick']}</td>
			<td>{$user['deposit']}</td>
			<td>{$user['member_phone']}</td>
			<td><?php echo date('Y-m-d', $user['checkin_time']); ?></td>
			<td><?php echo date('Y-m-d', $user['leaving_time']); ?></td>
			<td>{$user['eqment_1']}</td>
			<td>{$user['eqment_2']}</td>
			<td>{$user['eqment_3']}</td>
			<td>{$user['nickname']}</td>
			<td><?php echo date('Y-m-d H:i', $user['createtime']); ?></td>
			<td><?php echo $user['visible'] == 1 ? '租用中' : '已失效'; ?></td>
			<td>{$user['code']}</td>
			<td>
				<a href="javascript:void(0);" user_id="{$user['member_id']}" class="opens">启用</a> |
				<a href="javascript:void(0);" user_id="{$user['member_id']}" class="delete">停用</a> | 
				<a href="add.html?member_id={$user['member_id']}" user_id="{$user['member_id']}" class="set">编辑</a> | 
				<a href="javascript:void(0);" user_id="{$user['member_id']}" class="send">发送验证码</a>
			</td>
		</tr>
		<?php } }else{ ?>
		<tr align="center">
			<td colspan="14">暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<div class="pagination" style="float: right; widht: 95%">
	<include file="Common/page" />
</div>
<script>
	$(document).ready(function(){
		$("a.delete").on('click', function(){
			var obj = $(this);
			var user_id = obj.attr('user_id');
			var load = layer.load(2);
			$.post("remove.html",{user_id: user_id, status: 0}, function(data){
				if(data/1){
					layer.msg('设置成功');
					location.reload();
				}else{
					layer.msg('设置失败');
				}
			});
		});
		
		$("a.opens").on('click', function(){
			var obj = $(this);
			var user_id = obj.attr('user_id');
			var load = layer.load(2);
			$.post("remove.html",{user_id: user_id, status: 1}, function(data){
				layer.close(load);
				if(data/1){
					layer.msg('设置成功');
					location.reload();
				}else{
					layer.msg('设置失败');
				}
			});
		});

		$("a.send").on('click', function(){
			var obj = $(this);
			var user_id = obj.attr('user_id');
			var load = layer.load(2);
			$.get("send.html",{user_id: user_id}, function(data){
				layer.close(load);
				if(data/1){
					layer.msg('发送成功', {icon: 1, time: 2000});
				}else{
					layer.msg('发送失败', {icon: 2, time: 2000});
				}
			});
		})
	});
</script>